﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;


// The Grouped Items Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234231

namespace Mandoo
{
    /// <summary>
    /// A page that displays a grouped collection of items.
    /// </summary>
    public sealed partial class Dashboard : Mandoo.Common.LayoutAwarePage
    {
        public Dashboard()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            // TODO: Assign a collection of bindable groups to this.DefaultViewModel["Groups"]
            PopulateMenu();
        }

        private void GoBack(object sender, RoutedEventArgs e)
        {
            Frame.GoBack();

        }



        private void PopulateMenu()
        {
            List<Menu> Menus = new List<Menu>();
            DateTime startDate = DateTime.Now;

            Menu menu = new Menu();
            menu.Name = "Project 1";
            menu.MenuOptions.Add(new MenuOption() { Name = "Activity 1", Complete = true, DueDate = startDate.AddDays(4) });
            menu.MenuOptions.Add(new MenuOption() { Name = "Activity 2", Complete = true, DueDate = startDate.AddDays(5) });
            menu.MenuOptions.Add(new MenuOption() { Name = "Activity 3", Complete = false, DueDate = startDate.AddDays(7) });
            menu.MenuOptions.Add(new MenuOption() { Name = "Activity 4", Complete = false, DueDate = startDate.AddDays(9) });
            menu.MenuOptions.Add(new MenuOption() { Name = "Activity 5", Complete = false, DueDate = startDate.AddDays(14) });
            Menus.Add(menu);

            menu = new Menu();
            menu.Name = "Project 2";
            menu.MenuOptions.Add(new MenuOption() { Name = "Activity A", Complete = true, DueDate = startDate.AddDays(2) });
            menu.MenuOptions.Add(new MenuOption() { Name = "Activity B", Complete = false, DueDate = startDate.AddDays(3) });
            menu.MenuOptions.Add(new MenuOption() { Name = "Activity C", Complete = true, DueDate = startDate.AddDays(5) });
            menu.MenuOptions.Add(new MenuOption() { Name = "Activity D", Complete = false, DueDate = startDate.AddDays(9) });
            menu.MenuOptions.Add(new MenuOption() { Name = "Activity E", Complete = false, DueDate = startDate.AddDays(18) });
            Menus.Add(menu);

            menu = new Menu();
            menu.Name = "Project 3";
            Menus.Add(menu);


            groupedMenusViewSource.Source = Menus;
        }
    }
}
